﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CuFeZnList.aspx.cs" Inherits="StoragePeriod.Web.FoodTesting.CuFeZnFood.CuFeZnList" %>

<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
    .layout{background:url(../images/images_25.jpg) no-repeat; }
    .Right_title{width:764px; height:32px; background-position:0px 0px;}
    .Right_center{height:450px;}
    </style>
    <script src="/Scripts/highcharts/highcharts.js" type="text/javascript"></script>
    <script src="/Scripts/highcharts/modules/exporting.js" type="text/javascript"></script>
    <script src="/Scripts/sp_FoodTesting.js" type="text/javascript"></script>

    <script src="/Scripts/artDialog/artDialog.source.js?skin=default" type="text/javascript"></script>
    <script src="/Scripts/artDialog/plugins/iframeTools.source.js" type="text/javascript"></script>
    <script type="text/javascript">
        //Vc含量计算
        function Calculate(RawID) {
            var b = IsVerification();
            if (b) {
                var strdate = $("#MainContent_txt_date").val();
                var MineralTypeID = $("#MainContent_MineralTypeID").val();
                var TitleName='<%=this.FoodName%>';
                art.dialog.open('/FoodTesting/CuFeZnFood/CuFeZnEdit.aspx?RawID=' + RawID + "&FoodTime=" + strdate + "&FoodNum=1&MineralTypeID=" + MineralTypeID, { title: TitleName+'含量计算' });
            }
        }

        //检测说明
        function ShowFoodDirection() {
            var MineralTypeID = $("#MainContent_MineralTypeID").val();
            var TitleName = '<%=this.FoodName%>';
            art.dialog.open('/FoodTesting/FoodDirectionEdit.aspx?FoodID=' + MineralTypeID + '&ShowType=Show&Rid=' + Math.random(), { title: TitleName + '含量检测说明',
                init: function () {
                    var iframe = this.iframe.contentWindow;
                    if (iframe.document.body) {
                        iframe.document.location.reload();
                    };
                }
            });
        }
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".Right_title li").click(function () {
                $(".Right_title li").css("color", "#fff");
                $(this).css("color", "#f90");
                $(".center_Main").addClass("displaynone").removeClass("displayblock");
                $("#center_" + $(this).attr("showid")).removeClass("displaynone").addClass("displayblock");

                $("#MainContent_HidPageId").val($(this).attr("showid"));
            });
            $("input[type='radio']").live("click", function () {
                $(".radio_page").addClass("displaynone").removeClass("displayblock");
                $("#radio_page_" + $(this).val()).removeClass("displaynone").addClass("displayblock");

                $("#MainContent_HidShowId").val($(this).val());

            });
            $(".nav_menu li[SubmenuId='02']").trigger("mouseover");

            $("#input_datebtn").live("click", function () {
                $("#MainContent_txt_date").focus();
            });
            $("#input_dateStart").live("click", function () {
                $("#MainContent_txt_DateStart").focus();
            });
            $("#input_dateEnd").live("click", function () {
                $("#MainContent_txt_DateEnd").focus();
            });
        });

        function SetShowPage() {
            $(".Right_title li").css("color", "#fff");
            $(".Right_title li[showid='1']").css("color", "#f90");
            $(".center_Main").addClass("displaynone").removeClass("displayblock");
            $("#center_1").removeClass("displaynone").addClass("displayblock");
            $("input[type='radio'][value='" + $("#MainContent_HidShowId").val() + "']").trigger("click");
        }

        function Showdlg() {
            $("#dialog-form").dialog('open');
        }

        function IsVerification() {
            var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/
            if (!a.test($("#MainContent_txt_date").val())) {
                alert("日期格式不正确!")
                return false;
            }
            return true;
        }

        function IsVDel() {
            var b = true;
            var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/
            if (!a.test($("#MainContent_txt_date").val())) {
                b = false;
            }

            if (!b) {
                alert("日期格式不正确!");
                return b;
            }

            return confirm("确定删除当前日期下所选的原料Vc信息？");
        }



        function IsVerificationFX() {
            var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/
            if (!a.test($("#MainContent_txt_DateStart").val())) {
                alert("日期格式不正确!")
                return false;
            }
            else if (!a.test($("#MainContent_txt_DateEnd").val())) {
                alert("日期格式不正确!")
                return false;
            }
            else if ($("#MainContent_HidRawListId").val() == "") {
                alert("请选择原料!")
                return false;
            }
            else {
                return true;
            }
        }

        function loadReport() {
            var startime = $("#MainContent_txt_DateStart").val();
            var endtime = $("#MainContent_txt_DateEnd").val();
            var rawidlist = $("#MainContent_HidRawListId").val();
            var rawlistname = $("#MainContent_lab_RawListName").text();
            var MineralTypeName = $("#MainContent_MineralTypeName").val();

            sp.ajax.call("Report", { FunType: MineralTypeName, StartTime: startime, EndTime: endtime, RawIDList: rawidlist, RawListName: rawlistname },
            function (res) {
                DataBangding(res.Data.XName, res.Data.YData);
            }, null, true)
        }

        //刷新界面数据 食品检测编辑页面会用到
        function RefValue() {
            $("#MainContent_Btn_Search").trigger("click");
        }
    </script>
</asp:Content>
 

<asp:Content ID="BodyContentRight" ContentPlaceHolderID="MainContent" runat="server">
<div class="Right_title">
    <ul>
        <li id="Right_title_li_0" showid="0"><%=this.FoodName%>测定</li>
        <li showid="1"><%=this.FoodName%>测定分析</li>
    </ul>
</div>
<div class="Right_center">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:HiddenField ID="HidRawId" runat="server" Value="" />
    <asp:HiddenField ID="HidShowId" runat="server" Value="0" />
    <asp:HiddenField ID="HidPageId" runat="server" Value="0" />
    <asp:HiddenField ID="HidRawListId" runat="server" Value="" />
    <asp:HiddenField ID="MineralTypeID" runat="server" Value="10" />
    <asp:HiddenField ID="MineralTypeName" runat="server" Value="CuData" />
    <div id="center_0" class="center_Main displayblock">
        <div class="center_btnlist">
            <ul>
               <li>测定日期：</li>
               <li><asp:TextBox ID="txt_date" runat="server" CssClass="input ui-datapicker" ></asp:TextBox></li> 
               <li><input type="button" id="input_datebtn" value="" class="btn_date" /></li>
               <li class="width200"><asp:Button ID="Btn_Search" runat="server" Text="查询" 
                       CssClass="btn_0" OnClientClick="return IsVerification()" onclick="Btn_Search_Click" /></li>
               <li style="width:100px;"></li>
               <li><asp:button ID="Btn_Del" runat="server" Text="删除" CssClass="btn_0" 
                       OnClientClick="return IsVDel();" onclick="Btn_Del_Click" /></li>
               <li><asp:Button ID="Btn_Export" runat="server" Text="导出Excel" CssClass="btn_1" 
                       onclick="Btn_Export_Click" /></li>
                       <li><a href="javascript:ShowFoodDirection();" style=" color:Blue; font-weight:600; text-decoration:underline;">检测说明</a></li>
            </ul>
        </div>
        <div class="center_table">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td width="150px;">原料名称</td>
                        <td><%=this.FoodName%>含量</td>
                        <td width="100px;">操作</td>
                    </tr>
                </thead>
                <tbody>
                    <tr >
                        <td colspan="3" valign="top">
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <asp:Repeater ID="Rep_DataList" runat="server" 
                                        onitemcommand="Rep_DataList_ItemCommand" >
                                        <ItemTemplate>
                                            <tr>
                                                <td width="150px;"><%#Eval("RawName")%></td>
                                                <td><%#Eval("FoodResult")%></td>
                                                <td width="100px;">
                                                <input type="button" id="Btn_Calculate" value="" class="btn_Calculate" onclick="Calculate(<%#Eval("RawID") %>)" />
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <asp:Button ID="Btn_Del" runat="server" CssClass="btn_Del" OnClientClick="return confirm('确定删除？');" CommandName="Del" CommandArgument=<%#Eval("RawID") %> />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
        
    <div id="center_1" class="center_Main displaynone">
        <div class="center_btnlist">
            <ul>
               <li><input type="radio" value="0" name="radio_page_0" checked="checked" class="radiocss" />数据列表</li>
                <li class="width200"><input type="radio"  value="1" name="radio_page_0" class="radiocss" />曲线分析</li>
                <li>测定日期：</li>
                <li><asp:TextBox ID="txt_DateStart" runat="server" CssClass="input ui-datapicker" ></asp:TextBox></li> 
                <li><input type="button" id="input_dateStart" value="" class="btn_date" /></li>
                <li>至</li>
                <li><asp:TextBox ID="txt_DateEnd" runat="server" CssClass="input ui-datapicker" ></asp:TextBox></li>
                <li><input type="button" id="input_dateEnd" value="" class="btn_date"/></li>
                <li><asp:Button ID="Btn_SearchFX" runat="server" Text="查询" OnClientClick="return IsVerificationFX();" CssClass="btn_0" OnClick="Btn_SearchFX_Click" /></li>
            </ul>
        </div>
        <div class="center_table displayblock radio_page" id="radio_page_0">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td width="60px;">已选原料</td>
                        <%if (this.strDateList != null && this.strDateList.Count > 0) {
                              for (int i = 0; i < this.strDateList.Count; i++)
                              { 
                              %>
                                <td><%=this.strDateList[i].StrTime%></td>
                              <%
                              }
                          } %>
                    </tr>
                </thead>
                <tbody>
                    <%if (this.Assdatalist != null && this.Assdatalist.Count > 0) {
                          for (int i = 0; i < this.Assdatalist.Count; i++)
                          { 
                              %>
                                <tr>
                                    <td><%=this.Assdatalist[i][0].RawName%></td>
                                    <%if (this.Assdatalist[i][0].IsSelectRaw == 0)
                                      {
                                          for (int j = 0; j < this.Assdatalist[i].Count; j++)
                                          { 
                                      %>
                                        <td><%=this.Assdatalist[i][j].AssayScore%></td>
                                      <%
                                        }
                                      } %>
                                </tr>
                              <%
                          }
                      }
                      %>
                </tbody>
            </table>
        </div>
        <div class="center_table displaynone radio_page" id="radio_page_1">
            <table cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <td class="textleft">已选原料:<asp:Label ID="lab_RawListName" runat="server"></asp:Label> </td>
                    </tr>
                </thead>
                <tbody>
                    <tr >
                        <td>
                            <div class="Curve">
                                <div id="container" style="min-width: 750px; height: 330px; margin: 0 auto">
                                    
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
</div>

<div class="Right_foot">
    <img src="/images/images_29.jpg" width="764" height="8"/>
</div>
</asp:Content>